<?php 

$countries = array(	'tansania',
					'fiji',
					'loyaltyIslands',
					'newZealand',
					'solomonIslands',
					'papuaNewGuinea',
					'westPapuaNewGuinea',
					'australia'
					);


$__contents = 'package org.dschini.ui.maps.world.##Continent## {

	import flash.display.Sprite;
	import org.dschini.ui.maps.*;

	public class ##Country##Map extends Map
	{
		public var ##CountryToLower##MapStateLines:Sprite;
		public var ##CountryToLower##MapShape:Sprite;
		
		override public function set mouseEnabled( mouseEnabled:Boolean ):void
		{
			super.mouseEnabled = mouseEnabled;
			##CountryToLower##MapShape.mouseEnabled = mouseEnabled;
			##CountryToLower##MapStateLines.mouseEnabled = mouseEnabled;
		}
		
		override public function set doubleClickEnabled( doubleClickEnabled:Boolean ):void
		{
			super.doubleClickEnabled = doubleClickEnabled;
			##CountryToLower##MapShape.doubleClickEnabled = doubleClickEnabled;
			##CountryToLower##MapStateLines.doubleClickEnabled = doubleClickEnabled;
		}
		
		override public function render():void
		{
			##CountryToLower##MapShape.visible = data.shapeVisible ? true : false;
			if( data.shapeColorTransform ){
				##CountryToLower##MapShape.transform.colorTransform = data.shapeColorTransform;
			}
			##CountryToLower##MapStateLines.visible = data.stateLinesVisible ? true : false;
			if( data.stateLinesColorTransform ){
				##CountryToLower##MapStateLines.transform.colorTransform = data.stateLinesColorTransform;
			}
		}
	}	
}
';

$Continent = "oceania";

foreach( $countries as $country ){
	$FileName = ucfirst($country).'Map.as';

	if( file_exists( $FileName ) == false ){
		$fp = fopen($FileName, 'w');
		
		$healthy = array("##Continent##", "##Country##", "##CountryToLower##");
		$yummy = array($Continent,ucfirst($country),$country);
		$Contents = str_replace($healthy, $yummy, $__contents);
		
		fwrite($fp, $Contents);
		fclose($fp);
	}

}
